package com.android.studyspot;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.widget.TextView;

public class StudySpotInfoDialogFragment extends DialogFragment {
	
	private StudySpot idk;
	
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
    	
    	System.gc();
    	
    	//LayoutInflater inflater = this.getLayoutInflater(savedInstanceState);
    	LayoutInflater inflater = (LayoutInflater) this.getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    	
        // Use the Builder class for convenient dialog construction
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle(R.string.dialog_title);
        builder.setMessage("Creator: " + idk.getCreator() + "\n\nE-mail: " + idk.getCreatorEmail() + "\n\nCourse: " 
        		+ idk.getCourse() + "\n\nDate: " + idk.getDate() + "\n\nTime: " + idk.getStartEndTime() + "\n\nLocation:\n\n" + idk.getLocation());
        builder.setView(inflater.inflate(R.layout.layout_info_dialog, null))
               .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                   public void onClick(DialogInterface dialog, int id) {
                       //Do nothing
                   }
               });
               
		
        
        // Create the AlertDialog object and return it		
        return builder.create();
    }
    
    public StudySpotInfoDialogFragment(StudySpot ss){
    	this.idk = ss;
    }
}
